package com.wjp.dinosaur.service.impl;

import com.wjp.dinosaur.dao.mapper.UserMapper;
import com.wjp.dinosaur.dao.pojo.User;
import com.wjp.dinosaur.service.UserService;
import com.wjp.dinosaur.vo.Result;
import com.wjp.dinosaur.vo.parm.UserParm;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public Result addUser(UserParm userParm) {
        String password = userParm.getPassword();

        User user = new User();
        BeanUtils.copyProperties(userParm,user);
        int i = userMapper.insert(user);
        if (i > 1){
            System.out.println("插入成功");
        }
        return Result.success(true);
    }
}
